#{extends 'main.html' /}
#{set title:'Mon profil' /}
#{if flash.success}
<div class="greenbox">${flash.success}</div>
#{/if}

#{if flash.error}
<div class="errorbox">${flash.error}</div>
#{/if}
<div id="profile">
    <h3>Nom : ${user.getNom()}</h3>
    <h3>Prénom : ${user.getPrenom()}</h3>
    <img src="${image}"/>  
    </br>
    #{ifnot user.isProf() }
    <h4>Groupe : ${user.getGroupe().getLibelle()}</h4>      
    #{/ifnot}    
    <!-- barre abs-->
</div>

#{ifnot user.isProf() }
<div id="absences">
    <table style="border-collapse: collapse;">
        <tr>
            <th style="border: 1px solid black;">Début</th>
            <th style="border: 1px solid black;">Fin</th>
            <th style="border: 1px solid black;">Matière</th>
            <th style="border: 1px solid black;">Actions</th>
        </tr>
    #{list items:absences, as:'absence'}

        <tr>
            <td style="border: 1px solid black;">${new Date(absence.getSceance().getDebut()*1000).format('dd/MM/yyyy HH:mm')}</td>
            <td style="border: 1px solid black;">${new Date(absence.getSceance().getFin()*1000).format('dd/MM/yyyy HH:mm')}</td>
            <td style="border: 1px solid black;">${absence.getSceance().getMatiere()}</td>
            <td style="border: 1px solid black;">
                #{form @upload(), enctype:'multipart/form-data'}
                <input type="hidden" name="abs" value="${absence.getId()}">
                <input type="file" name="fichier" #{if absence.isJustifie() } disabled #{/if}>
                <input type="submit" value="Justifier" #{if absence.isJustifie() } disabled #{/if}/>
                #{/form}
            </td>
        </tr>
    #{/list}

    </table>
</div>
#{/ifnot}
